package org.hawk.gwt.ppc.parser.impl;

import org.hawk.gwt.ppc.parser.NoSuchTokenException;
import org.hawk.gwt.ppc.parser.Token;
import org.hawk.gwt.ppc.utils.PreprocessorException;

/**
 * Source of tokens to be interpreted by parser.
 * 
 * @author alex.bereznevatiy@gmail.com
 *
 */
interface TokenSource {

	/**
	 * @return current token or throws {@link NoSuchTokenException} in case there are no tokens yet.
	 */
	Token current();

	/**
	 * @return <code>true</code> if there are some more tokens to read.
	 */
	boolean hasNext();

	/**
	 * @return next token read from input source
	 * @throws PreprocessorException in case of problems
	 */
	Token next() throws PreprocessorException;

	/**
	 * Mark this tokenizer as reached end of file.
	 * After this any parsing should be stopped.
	 */
	void eof();

	/**
	 * @return <code>true</code> if this tokenizer is marked as reached end of file.
	 */
	boolean isEof();

}